package server;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import marauroa.server.marauroad;

public class Servlet extends HttpServlet {

	@Override
	public void init() throws ServletException {
		Thread myThread = new Thread(new BootStrap());
		myThread.start();
	}
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		PrintWriter writer = resp.getWriter();
		writer.println("<h1>Hello, World!</h1>");
	}
	
	private class BootStrap implements Runnable {

		@Override
		public void run() {
			String myArgs[] = {"-c", "C:/Users/owner/project/serverside/server.ini"};
			marauroad.main(myArgs);
		}
	}
}
